<template>
  <a-card :bordered="false">
    <a-table
      bordered
      :columns="columns"
      :dataSource="tableData"
      :loading="loading"
      :rowKey="record => record.id"
      :pagination="false"
    >
    </a-table>
  </a-card>
</template>

<script>
import { getTree } from '@api/boms/productBom'

export default {
  name: 'ShowBoms',
  components: {
  },
  data () {
    return {
      loading: false,
      number: '',
      columns: [
        {
          title: '料品编码',
          dataIndex: 'number'
        },
        {
          title: '料品名称',
          dataIndex: 'name'
        },
        {
          title: '规格型号',
          dataIndex: 'specifications'
        },
        {
          title: '父级产品',
          dataIndex: 'parentNumber'
        },
        {
          title: '料品属性',
          dataIndex: 'prope'
        },
        {
          title: '配比系数',
          dataIndex: 'matching'
        },
        {
          title: '计量单位',
          dataIndex: 'unit'
        },
        {
          title: '备注',
          dataIndex: 'remark'
        }
      ],
      tableData: []
    }
  },
  methods: {
    init (number) {
      this.loading = true
      getTree(number).then(res => {
        this.tableData = res.data
        this.loading = false
      })
    }
  },
  created () {
    this.number = this.$route.query.number
    this.init(this.number)
  }
}
</script>

<style scoped>

</style>
